function pos = detector(img)
% todo
hsv = rgb2hsv(img);
h = hsv(:,:,1);
s = hsv(:,:,2);
v = hsv(:,:,3);
threhold_h = [0.39 0.44];
threhold_s = [0.9 1.0];
threhold_v = [0.4 0.7];
kernel = ones(4,4);
[a,b,c] = size(hsv);
mask = zeros(a,b);
for i=1:a
    for j=1:b
        if(h(i,j)>threhold_h(1)&&h(i,j)<threhold_h(2) && s(i,j)>threhold_s(1)&&s(i,j)<threhold_s(2) && v(i,j)>threhold_v(1)&&v(i,j)<threhold_v(2))
            mask(i,j) = 255;
        end
    end
end

dilation = imdilate(mask,kernel);
B = bwboundaries(dilation);
if ~isempty(B)
    boundary=B{1,1};
    [rx,ry,area]=minboundrect(boundary(:,2),boundary(:,1));
    w = max(rx)-min(rx);
    h = max(ry)-min(ry);
    if(w>50 && h>50)
        pos = [rx(1) ry(1)];
    else
        pos = [];
    end
else
    pos = [];
end
end % end of function
